package com.erp.enums;

/**
 * @ClassName : ProductTypeEnum
 * @Description : 产品类型枚举(1:成品 2:配件 3:料件)
 * @Author : lst
 * @Date: 2020-10-20 20:18
 */
public enum ProductTypeEnum {

    END_PRODUCT(1, "成品"),
    FITTING(2, "配件"),
    MATERIAL(3, "料件");

    /**
     * id
     */
    private int id;

    /**
     * 描述
     */
    private String desc;

    public int getId() {
        return id;
    }

    public String getDesc() {
        return desc;
    }

    ProductTypeEnum(int id, String desc) {
        this.id = id;
        this.desc = desc;
    }

    /**
     * 通过id获取描述信息
     * @param id
     * @return
     */
    public static String getDescById(Integer id){
        if(null == id){
            return "";
        }
        for(ProductTypeEnum productTypeEnum : ProductTypeEnum.values()){
            if(productTypeEnum.getId() == id){
                return productTypeEnum.getDesc();
            }
        }
        return "";
    }
}
